<?php defined('IN_NWIDC') or exit('Access Invalid!');?>

<div class="page">
  <div class="fixed-bar">
    <div class="item-title">
      <h3>第三方登录</h3>
      <ul class="tab-base"><li><a class="current"><span>第三方登录</span></a></li></ul>
    </div>
  </div>
  <div class="fixed-empty"></div>
<style type="text/less">

  #frm_config_basic{
    tr{
      line-height: 30px;
    }
    tr:first-child{
      line-height: 40px;
    }
    th{
      font-weight: bold;
    }

    button{
      display: none;
    }

    input[type="text"]{
      margin-right: 60px;
    }
  }
</style>
<script>less = { env: 'development'};</script>
<script src='/static/images/less.js'></script>

 <form name="frm_config_basic" id="frm_config_basic"  method="post" accept-charset="utf-8">
  <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <th scope="row" width="130">开启哪些接口：</th>
      <td class='api'>
        <label for="qq_api_open">
          <input type="checkbox" name="api[qq]" rel="qq" value="1" id="qq_api_open" checked="checked">QQ账号</label>
        <label for="sina_api_open">
          <input type="checkbox" name="api[sina]" rel="sina" value="1" id="sina_api_open" checked="checked">新浪微博</label>
        <label for="baidu_api_open">
          <input type="checkbox" name="api[baidu]" rel="baidu" value="1" id="baidu_api_open" checked="checked">百度</label>
        <label for="taobao_api_open">
          <input type="checkbox" name="api[taobao]" rel="taobao" value="1" id="taobao_api_open" checked="checked">淘宝</label>
        <label for="douban_api_open">
          <input type="checkbox" name="api[douban]" rel="douban" value="1" id="douban_api_open" checked="checked">豆瓣</label>
        <label for="renren_api_open">
          <input type="checkbox" name="api[renren]" rel="renren" value="1" id="renren_api_open" checked="checked">人人</label>
      </td>
    </tr>
    <tbody id="qq">
      <tr>
        <th scope="row" width="130">QQappid：</th>
        <td>
          <input type="text" size="50" name="conf[qq_app_id]" id="qq_appid" class="txt" value="" limit="type:int" msg="QQappid" title="填写正确的QQappid" msgArea="txt_qq_appid_msg" />
<span id="txt_qq_appid_msg"></span>(QQ开发者平台提供的api编号)
          <button id="reg" onclick="window.open('http://connect.qq.com/intro/login/')" type="button" class="pill">
<span class="icon plus">&nbsp;</span>点击申请</button>
        </td>
      </tr>
      <tr>
        <th scope="row" width="130">QQappsecret：</th>
        <td>
          <input type="text" size="50" name="conf[qq_app_secret]" id="qq_appsecret" value="" limit="type:string" msg="QQappsecret" title="填写正确的QQappsecret" msgArea="txt_qqsecret_msg" class="txt" />
<span id="txt_qqsecret_msg"></span>(QQ开发者平台提供的app_secret编号)</td>
      </tr>
    </tbody>
    <tbody id="alipay" style="display:none">
      <tr>
        <th scope="row" width="130">支付宝appid：</th>
        <td>
          <input type="text" size="50" name="conf[alipay_app_id]" id="alipay_appid" value="" limit="type:int" msg="支付宝appid" title="填写正确的支付宝appid" msgArea="txt_alipay_appid_msg" class="txt" /> <span id="txt_alipay_appid_msg"></span>(支付宝开发者平台提供的api编号)
          <button id="reg" onclick="window.open('https://b.alipay.com/order/productDetail.htm?productId=2011042200323155')" type="button" class="pill">
<span class="icon plus">&nbsp;</span>点击申请</button>
        </td>
      </tr>
      <tr>
        <th scope="row" width="130">支付宝appsecret：</th>
        <td>
          <input type="text" size="50" name="conf[alipay_app_secret]" id="alipay_appsecret" value="" limit="type:string" msg="支付宝appsecret" title="填写正确的支付宝appsecret" msgArea="txt_alipay_secret_msg" class="txt" />
<span id="txt_alipay_secret_msg"></span>(支付宝开发者平台提供的app_secret编号)</td>
      </tr>
    </tbody>
    <tbody id="taobao">
      <tr>
        <th scope="row" width="130">淘宝appid：</th>
        <td>
          <input type="text" size="50" name="conf[taobao_app_id]" id="taobao_appid" value="" limit="type:int" msg="淘宝appid" title="填写正确的淘宝appid" msgArea="txt_taobao_appid_msg" class="txt" /> <span id="txt_taobao_appid_msg"></span>(淘宝开发者平台提供的api编号)
          <button id="reg" onclick="window.open('http://open.taobao.com/app_access.htm')" type="button" class="pill">
<span class="icon plus">&nbsp;</span>点击申请</button>
        </td>
      </tr>
      <tr>
        <th scope="row" width="130">淘宝appsecret：</th>
        <td>
          <input type="text" size="50" name="conf[taobao_app_secret]" id="taobao_appsecret" value="" limit="type:string" msg="淘宝appsecret" title="填写正确的淘宝appsecret" msgArea="txt_taobao_secret_msg" class="txt" />
<span id="txt_taobao_secret_msg"></span>(淘宝开发者平台提供的app_secret编号)</td>
      </tr>
    </tbody>
    <tbody id="sina">
      <tr>
        <th scope="row" width="130">Sina appid：</th>
        <td>
          <input type="text" size="50" name="conf[sina_app_id]" id="sina_app_id" value="" limit="type:string" msg="Sina appid" title="填写正确的新浪appsecret" msgArea="txt_sinaappid_msg" class="txt" /> <span id="txt_sinaappid_msg"></span>(新浪开发者平台提供的api编号)
          <button id="reg" onclick="window.open('http://open.weibo.com/connect')" type="button" class="pill">
<span class="icon plus">&nbsp;</span>点击申请</button>
        </td>
      </tr>
      <tr>
        <th scope="row" width="130">Sina appsecret：</th>
        <td>
          <input type="text" size="50" name="conf[sina_app_secret]" id="sina_app_secret" value="" class="txt" limit="type:string" msg="新浪微博appsecret" title="填写正确的新浪appsecret" msgArea="txt_sinasecret_msg" /> <span id="txt_sinasecret_msg"></span>(新浪开发者平台提供的app_secret编号)</td>
      </tr>
    </tbody>
    <tbody id="ten" style="display:none">
      <tr>
        <th scope="row" width="130">Tencent appid：</th>
        <td>
          <input type="text" size="50" name="conf[ten_app_id]" id="ten_app_id" value="" limit="type:string" msg="Tencent appid" title="填写正确的腾讯appsecret" msgArea="txt_tenappid_msg" class="txt" /> <span id="txt_tenappid_msg"></span>(腾讯开发者平台提供的api编号)
          <button id="reg" onclick="window.open('http://open.t.qq.com/develop.php')" type="button" class="pill">
<span class="icon plus">&nbsp;</span>点击申请</button>
        </td>
      </tr>
      <tr>
        <th scope="row" width="130">Tencent appsecret：</th>
        <td>
          <input type="text" size="50" name="conf[ten_app_secret]" id="ten_app_secret" value="" limit="type:string" msg="Tencent appsecret" title="填写正确的腾讯appsecret" msgArea="txt_tensecret_msg" class="txt" /> <span id="txt_tensecret_msg"></span>(腾讯开发者平台提供的app_secret编号)</td>
      </tr>
    </tbody>
    <tbody id="baidu">
      <tr>
        <th scope="row" width="130">百度appid：</th>
        <td>
          <input type="text" size="50" name="conf[baidu_app_id]" id="baidu_app_id" value="" limit="type:string" msg="百度appid" title="请输入百度开发者平台提供的api编号" msgArea="txt_baiduappid_msg" class="txt" /> <span id="txt_baiduappid_msg"></span>(百度开发者平台提供的api编号)
          <button id="reg" onclick="window.open('http://developer.baidu.com/mobile')" type="button" class="pill">
<span class="icon plus">&nbsp;</span>点击申请</button>
        </td>
      </tr>
      <tr>
        <th scope="row" width="130">百度appsecret：</th>
        <td>
          <input type="text" size="50" name="conf[baidu_app_secret]" id="baidu_app_secret" value="" limit="type:string" msg="百度appsecret" title="请输入百度开发者平台提供的app_secret编号" msgArea="txt_baidusecret_msg" class="txt" /> <span id="txt_baidusecret_msg"></span>(百度开发者平台提供的app_secret编号)</td>
      </tr>
    </tbody>
    <tbody id="sohu" style="display:none">
      <tr>
        <th scope="row" width="130">搜狐appid：</th>
        <td>
          <input type="text" size="50" name="conf[sohu_app_id]" id="sohu_app_id" value="" class="txt" limit="type:string" msg="sohu appid" title="填写正确的搜狐appsecret" msgArea="txt_souhuappid_msg" />
<span id="txt_souhuappid_msg"></span>(搜狐开发者平台提供的api编号)
          <button id="reg" onclick="window.open('http://open.t.sohu.com/apps/myapps')" type="button" class="pill">
<span class="icon plus">&nbsp;</span>点击申请</button>
        </td>
      </tr>
      <tr>
        <th scope="row" width="130">搜狐appsecret：</th>
        <td>
          <input type="text" size="50" name="conf[sohu_app_secret]" id="sohu_app_secret" value="" class="txt" limit="type:string" msg="sohu appsecret" title="填写正确的搜狐appsecret" msgArea="txt_souhusecret_msg" /> <span id="txt_souhusecret_msg"></span>(搜狐开发者平台提供的app_secret编号)</td>
      </tr>
    </tbody>
    <tbody id="renren">
      <tr>
        <th scope="row" width="130">人人appid：</th>
        <td>
          <input type="text" size="50" name="conf[renren_app_id]" id="renren_appid" class="txt" value="" limit="type:string" msg="QQappid" msgArea="txt_renren_appid_msg" />
<span id="txt_renren_appid_msg"></span>(人人开发者平台提供的api编号)
          <button id="reg" onclick="window.open('http://dev.renren.com/')" type="button" class="pill">
<span class="icon plus">&nbsp;</span>点击申请</button>
        </td>
      </tr>
      <tr>
        <th scope="row" width="130">人人appsecret：</th>
        <td>
          <input type="text" size="50" name="conf[renren_app_secret]" id="renren_appsecret" value="" limit="type:string" msg="QQappsecret" msgArea="txt_renrensecret_msg" class="txt" />
<span id="txt_renrensecret_msg"></span>(人人开发者平台提供的app_secret编号)</td>
      </tr>
    </tbody>
    <tbody id="douban">
      <tr>
        <th scope="row" width="130">豆瓣appid：</th>
        <td>
          <input type="text" size="50" name="conf[douban_app_id]" id="douban_appid" class="txt" value="" limit="type:string" msg="doubanappid" msgArea="txt_douban_appid_msg" />
<span id="txt_douban_appid_msg"></span>(豆瓣开发者平台提供的api编号)
          <button id="reg" onclick="window.open('http://developers.douban.com/')" type="button" class="pill">
<span class="icon plus">&nbsp;</span>点击申请</button>
        </td>
      </tr>
      <tr>
        <th scope="row" width="130">豆瓣appsecret：</th>
        <td>
          <input type="text" size="50" name="conf[douban_app_secret]" id="douban_appsecret" value="" limit="type:string" msg="doubanappsecret" msgArea="txt_doubansecret_msg" class="txt" />
<span id="txt_doubansecret_msg"></span>(豆瓣开发者平台提供的app_secret编号)</td>
      </tr>
    </tbody>
    <tr>
      <td colspan="20">
        <div class="clearfix padt10">
          <div style='height:15px;'></div>
          <a href="javascript:;" onclick='$(this).closest("form").submit()' class='btn'>提交</a>
        </div>
      </td>
    </tr>
  </table>
</form>


<?php
  $info = include(BASE_PATH . '/_login.php');
?>
<script>
  var info = <?php echo json_encode($info);?>;
  for(var i in info.api){
    $('.api input').each(function(){
        if(this.name == 'api[' + i + ']'){
            this.checked = Number(info.api[i]) && true || false;
        }
    });
  }

  for(var i in info.conf){
    $('tr input').each(function(){
      if(this.name == 'conf[' + i + ']'){
        this.value = info.conf[i];
      }
    });
  }
</script>


  <table class="table tb-type2" style='display:none'>
    <thead>
      <tr class="thead">
        <th>接口名</th>
        <th class='align-center'>是否开启</th>
        <th class="align-center"><?php echo $lang['nc_handle'];?></th>
      </tr>
    </thead>
    <tbody>
      <?php
        $ligonList = Model('thirdparty_login')->select();
      ?>
      <?php if(!empty($ligonList) && is_array($ligonList)){ foreach($ligonList as $k => $v){ ?>;
      <tr class="hover">
        <td><?php echo $v['name'];?></td>
        <td class="w25pre align-center">
          <?php echo $v['status'] == '1' ? '是' : '否';?>
        </td>
        <td class="w156 align-center"><a href="index.php?act=else_login&op=edit&id=<?php echo $v['id']; ?>"><?php echo $lang['nc_edit']?></a></td>
      </tr>
      <?php } } ?>
    </tbody>
    <tfoot>
      <tr class="tfoot">
        <td colspan="15"></td>
      </tr>
    </tfoot>
  </table>
</div>